<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/29
 * Time: 15:16
 */

namespace Home\Model;


use Think\Model;

/**
 * Class UserinfoModel
 * @package Home\Model
 * 用户详细信息
 */
class UserinfoModel  extends  Model
{
    protected $tableName='userinfo';
    protected $_validate=[
        ['nickname','require','请填写昵称'],
        ['birth','require','请填写出生日期'],
    ];
//    用户信息修改
    public  function store($data){
//        dd($data);die;
       if($this->create($data)){
          $res= $this->where("uid={$data['uid']}")->save($data); // 根据条件更新记录
           return ['valid'=>1,'msg'=>'修改成功'];
       }else{
           return ['valid'=>0,'msg'=>$this->getError()];
       }
    }
    //添加用户信息
    public function addinfo($data){
        $this->add($data);
    }
}